package com.castle.fortress.admin.cms.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.castle.fortress.admin.cms.entity.CmsArticleEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
/**
 * cms内容管理表Mapper 接口
 *
 * @author castle
 * @since 2022-03-10
 */
public interface CmsArticleMapper extends BaseMapper<CmsArticleEntity> {

	/**
	 * 扩展信息列表
	 * @param pageMap
	 * @param cmsArticleEntity
	 * @param roldIds
	 * @return
	 */
	List<CmsArticleEntity> extendsList(@Param("map")Map<String, Long> pageMap, @Param("cmsArticleEntity") CmsArticleEntity cmsArticleEntity,@Param("roldIds")List<Long> roldIds);

	/**
	 * 扩展信息记录总数
	 * @param cmsArticleEntity
	 * @param roldIds
	 * @return
	 */
	Long extendsCount(@Param("cmsArticleEntity") CmsArticleEntity cmsArticleEntity,@Param("roldIds")List<Long> roldIds);

	/**
	 * cms内容管理表扩展详情
	 * @param id cms内容管理表id
	 * @return
	 */
      CmsArticleEntity getByIdExtends(@Param("id")Long id);


	List<Map<String,Object>> cmsTagChannelCmsArticle(@Param("map")Map<String, Object> map);


	Integer cmsTagCountChannelCmsArticle(@Param("map")Map<String, Object> map);

    List<CmsArticleEntity> listByChannel(@Param("code")String code);

	List<CmsArticleEntity> listBySubject(@Param("code")String code);

	List<CmsArticleEntity> listByTag(@Param("title")String title);

	List<CmsArticleEntity> cmsTagSpecialCmsArticle(@Param("map")Map<String, Object> map);

	Integer cmsTagCountSpecialCmsArticle(@Param("map")Map<String, Object> map);

	List<CmsArticleEntity> cmsTagTagCmsArticle(@Param("map")Map<String, Object> map);

	Integer cmsTagCountTagCmsArticle(@Param("map")Map<String, Object> map);

	List<CmsArticleEntity> cmsTagSearchCmsArticle(@Param("map")Map<String, Object> map);

	Integer cmsTagCountSearchCmsArticle(@Param("map")Map<String, Object> map);

    List<CmsArticleEntity> extendsAuditList(@Param("map")Map<String, Long> pageMap, @Param("cmsArticleEntity")CmsArticleEntity cmsArticleEntity, @Param("userId")Long userId);

	Long extendsAuditCount(@Param("cmsArticleEntity")CmsArticleEntity cmsArticleEntity,@Param("userId") Long userId);

	Integer moveChannel(@Param("ids")List<Long> ids,@Param("channelId") Long channelId);

	Integer toDrafts(@Param("ids")List<Long> ids);

	Integer toDelReal(@Param("ids")List<Long> ids);

	Integer toGarbage(@Param("ids")List<Long> ids);

	/**
	 * 待审核转发布
	 * @param channelId
	 */
	void cancelToPub(@Param("channelId")Long channelId);

	/**
	 * 审核失败转草稿
	 * @param channelId
	 */
	void cancelToDrafts(@Param("channelId")Long channelId);
}

